package day07;

import java.util.Scanner;

public class CalAirPrice {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入原价：");
        double price= scan.nextDouble();
        System.out.println("请输入月份");
        int month= scan.nextInt();
        System.out.println("请选择仓位：1.头等舱2.商务舱3.经济舱");
        int num=scan.nextInt();


        double finalPrice=finalPrice(price,month,num);
        System.out.print("原价为："+price+"\t月份为："+month+"\t舱位为："+num+"\t最终的价格为："+finalPrice);
    }
    public static double finalPrice(double price,int month,int num){
        System.out.println(price);
        System.out.println(month);
        if (month<1 || month>12){
            return -1;
        }
        switch (num){
            case 1:
                System.out.println("头等舱");
                break;
            case 2:
                System.out.println("商务舱");
                break;
            case 3:
                System.out.println("经济舱");
        }
           if (num<1 || num>3) {
               return -1;
           }
               double finPrice=0.0;
               if (month>=5 && month<=10 && num==1){
                   finPrice=price*0.6;
               }
               else if (month>=5 && month<=10 && num==2){
                   finPrice=price*0.7;
               }
               else if (month>=5 && month<=10 && num==3){
                   finPrice=price*0.8;
               }else if (month>=11  && num==1){
                   finPrice=price*0.7;
               }else if (month>=1 && month<=4 && num==2){
                   finPrice=price*0.8;
               }else if (month>=1 && month<=4 && num==3){
                   finPrice=price*0.9;
               }
               return finPrice;
    }

}
